
package clientapp;

import javax.microedition.lcdui.*;

/**
 *
 */
public class SelectoplView extends List implements CommandListener {
    
    private ControllerMIDlet midlet;
    
    /**
     * constructor
     */
    public SelectoplView(ControllerMIDlet midlet) {
        super("Selecteer een opleiding", Choice.IMPLICIT);
        this.midlet = midlet;
       
        try {
            // Set up this list to listen to command events
            setCommandListener(this);
            // Add the Back command
            addCommand(new Command("back", Command.BACK, 1));
            addCommand(new Command("Bekijk opleiding", Command.OK, 6));
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    /**
     * Called when action should be handled
     */
    public void commandAction(Command command, Displayable displayable) {
        if (command.getCommandType() == Command.BACK) {
            
            midlet.getSelectView();
            this.deleteAll();
        }switch(command.getPriority()) {
           case 6: midlet.bekijkOpl(this.getSelectedIndex());
               midlet.getSelectieList();
        }
    }

}
